<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .temp {
            width: 500px;
            height: 50px;
            border: 1px solid #333;
        }
    </style>
    <script src="./jquery-1.12.4.min.js"></script>
</head>

<body>
    <div class="temp">
        <h1 class="title"></h1>
        <p class="author"></p>
        <p class="poety"></p>
    </div>
    <button class="send">发送</button>
    <button class="setSeason">设置季节</button>
    <button class="getSeason">获取季节</button>
    <button class="getTemp">获取温度</button>
    <script>
        $('.send').click(function () {
            $.ajax(
                {
                    type: 'GET',
                    url: 'https://api.apiopen.top/searchPoetry',
                    data: { name: '咏鹅' },
                    success: function (msg) {
                        console.log(msg);
                    },
                    error: function (err) {
                        console.log(err);
                    }
                }
            );
        });

        //设置 POST 
        $('.setSeason').on("click", function () {
            $.ajax({
                type: 'POST',
                url: 'http://10.1.93.241:8082/setSeason.do',
                data: { Season: 'Summer' },
                success: function (res) {
                    console.log(res);
                },
                error: function (err) {
                    console.log(err);
                }
            });
        })
        $('.getSeason').on("click", function () {
            $.ajax({
                type: 'GET',
                url: 'http://10.1.93.241:8082/getSeason.do',
                success: function (res) {
                    console.log(res);
                },
                error: function (err) {
                    console.log(err);
                }
            });
        })
        $('.getTemp').on("click", function () {
            $.ajax({
                type: 'GET',
                url: 'http://10.1.93.241:8082/GetTemp.do',
                success: function (res) {
                    console.log(res);
                },
                error: function (err) {
                    console.log(err);
                }
            });
        })
    </script>
</body>

</html>